package cn.enilu.flash.warpper;

import cn.enilu.flash.enums.body.*;
import cn.enilu.flash.service.system.impl.ConstantFactory;
import cn.enilu.flash.utils.StringUtils;

import java.util.List;
import java.util.Map;

/**
 * @Description
 * @Author Spark
 * @Date Created in (2020/04/28 17:55)
 * @Version v1.0
 * @Modify
 **/
public class RepairInfoarpper extends BaseControllerWarpper {
    public RepairInfoarpper(List<Map<String, Object>> list) {
        super(list);
    }

    @Override
    public void warpTheMap(Map<String, Object> map) {
        map.put("applyTypeName", RepairApplyType.valueOfCode((Integer) map.get("applyType")));
        map.put("stateName", RepairState.valueOfCode((Integer) map.get("state")));
        map.put("feeStateName", FeeState.valueOfCode((Integer) map.get("feeState")));
//        if(StringUtils.isNotNullOrEmpty(map.get("communityId"))) {
//            map.put("communityName", ConstantFactory.me().getCommunityNameById((Long) map.get("communityId")));
//        }
        if(StringUtils.isNotNullOrEmpty(map.get("buildingId"))) {
            map.put("buildingName", ConstantFactory.me().getBuildingNameById((Long) map.get("buildingId")));
        }
        if(StringUtils.isNotNullOrEmpty(map.get("roomId"))) {
            map.put("roomName", ConstantFactory.me().getRoomNameById((Long) map.get("roomId")));
        }
        map.put("house", map.get("buildingName") + " / " + map.get("roomName"));
        map.put("custName", ConstantFactory.me().getCustNameById((Long) map.get("custId")));
        map.put("userName", ConstantFactory.me().getUserNameById((Long) map.get("executeUserId")));
        map.put("userMobile", ConstantFactory.me().getUserMobileById((Long) map.get("executeUserId")));
    }
}